package cn.com.algery.temp.filter;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.web.filter.authc.UserFilter;

public class MyUserFilter extends UserFilter {
	protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
		HttpServletRequest req = (HttpServletRequest) request;
        HttpServletResponse res = (HttpServletResponse) response;
        if("OPTIONS".equals(req.getMethod())) {
        	res.setStatus(200);
        	return false; // False means no further operation
        }
        saveRequestAndRedirectToLogin(request, response);
        return false;
    }
}
